<template>
  <div class="login">
    <div class="welcome"><img src="../assets/images/welcome.png"></div>
    <form>
      <div class="login-form" @submit.prevent="login()">
        <div class="login-inp"><label>Login:</label><input type="text" placeholder="" id="login"></div>
        <div class="login-inp"><label>Password:</label><input type="password" placeholder="" id="pw"></div>
        <div class="login-inp"><a href="#" id="loginB" @click="login()">Login</a></div>
      </div>
    </form>
    <div class="login-txt">
      <router-link to="/forget">
        Forget  Password
      </router-link>
      |
      <router-link to="/user-reg">
        Register Now
      </router-link>
     </div>
    <div class="dbgao" style="height:80px;"></div>
  </div>
</template>
<script>

  export default{
    mounted(){

    },
    methods: {
      login(){
        var login = document.getElementById('login');
        var pw = document.getElementById('pw');
        this.$http.jsonp(global.URL + "/loginSubmit", //跨域请求接口
          {
            params: {
              telephone: login.value,
              password: pw.value
            }
          }).then(function (response) {
          console.info(response.data);
          if (response.data=="true") {
            this.$router.replace({path: '/home'});
          } else {
            alert("Login fail，maybe password is wrong");
          }
        }, function (error) {
          alert("Login  Fail,Please connect with manager");
        });


      }

    },
    components: {}
  }
</script>
<style>
  @import '../assets/css/common.css';
  @import '../assets/css/login.css';
</style>

